Multivariate Analysis of Network data

Note: This tutorial is bascially the same as the on described in “Protocol_multivariate.R”. Either download the repo or, much easier, just copy the script and paste into your r script.

Intro & Basics

The question addressed here is whether network traits “cluster” according to species identity For this we are using:

  • PCA: To visualize whether there is any clustering
  • Difference in the correlations among variables per species
  • PERMANOVA: to test difference among groups

To do that I use base R functions combined with functions from three other packages: vegan, tidyverse and RColorBrewer You might need to install those packages. You can do that via R studio or:

#install.packages("vegan")
#install.packages("tidyverse")
#install.packages("RColorBrewer")

#Comment in if needed!

1. Loading files.

Note: one can load directly excel files (.xlxs) using R studio. This is a relatively new feature. I am used to the function “read.csv” for which I need to save the excel sheet I am interested as a csv file first. In this case, I saved the “edge” sheet of each excel file of each of the 6 species as .csv

First Edge files

#These lines will load all files saved as .csv in the folder "processedData" and then merging them ("row bind")
temp = list.files(path="processedData\\",pattern="*-Edge.csv")
temp<-paste("processedData\\",temp,sep = "")
myfiles = lapply(temp,function(x){read.csv(x,header = TRUE,stringsAsFactors = FALSE)} )
#myfiles[[4]]<-myfiles[[4]][,c(1:42)]
Edge_Traits<-do.call(rbind,myfiles)

Edge_Traits$Species<-NA
Edge_Traits$Species[grep("C34",Edge_Traits$name)]<-"Mortierella elongata"
Edge_Traits$Species[grep("C35",Edge_Traits$name)]<-"Umbelopsis isabellina"
Edge_Traits$Species[grep("DF19",Edge_Traits$name)]<-"Mortierella alpina"
Edge_Traits$Species[grep("DF25",Edge_Traits$name)]<-"Mortierella elongata2"
Edge_Traits$Species[grep("DF56",Edge_Traits$name)]<-"Mucor fragilis"
Edge_Traits$Species[grep("M",Edge_Traits$name)]<-"Mortierella alpina2"

#Assuming the Or_ij can be expressed from 0 to 360 degrees
Edge_Traits$Or_ij[which(Edge_Traits$Or_ij<0)]<-(Edge_Traits$Or_ij[which(Edge_Traits$Or_ij<0)]*-1)+180

Edge_Traits<-Edge_Traits[which(Edge_Traits$Type=="E"),]

#I am removing seven values with Width=0
Edge_Traits<-Edge_Traits[-which(Edge_Traits$Width==0),]

2. Getting to know the data.

2.1 How R sees the data.

It is useful to have an idea on how R recognize the data. R is an “object oriented” program language. That is, every data is an object which has certain properties. R uses these properties to categorized the object. It is useful to know what kind of object is your data because some functions only work on one object type but not in others.

str(Edge_Traits)
## 'data.frame':    605130 obs. of  56 variables:
##  $ name                     : chr  "C34(1)_t11" "C34(1)_t11" "C34(1)_t11" "C34(1)_t11" ...
##  $ channel                  : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ section                  : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ frame                    : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ EndNodes_1               : int  1 2 3 4 5 6 7 7 8 8 ...
##  $ EndNodes_2               : int  13 4 4 13 7 8 10 12 9 51 ...
##  $ node_Idx_1               : int  1237662 3257824 3296651 3348477 4526081 4680869 4720355 4720355 4823328 4771532 ...
##  $ node_Idx_2               : int  5032232 3348477 3348477 5032232 4720355 4771532 4901665 5018246 4771532 7245376 ...
##  $ Name                     : int  1 2 3 4902 4 5 4904 4903 6 4905 ...
##  $ Type                     : chr  "E" "E" "E" "E" ...
##  $ Weight                   : num  1122.73 5.64 833.53 21.16 186.58 ...
##  $ Original                 : num  0.601 0.469 0.305 0.611 0.282 ...
##  $ Original_cv              : num  0.233 0.125 0.372 0.175 0.219 ...
##  $ Intensity                : num  0.891 0.458 0.201 0.942 0.148 ...
##  $ Intensity_cv             : num  0.264 0.402 1.004 0.123 0.336 ...
##  $ Gradient                 : num  90.7 43.9 21.4 94.3 16.9 ...
##  $ Gradient_cv              : num  0.297 0.365 0.818 0.193 0.255 ...
##  $ Width_initial            : num  4.688 2.402 1.042 4.929 0.706 ...
##  $ Width_initial_cv         : num  0.277 0.342 1.002 0.136 0.505 ...
##  $ Width_intact             : int  1 1 1 1 1 1 1 1 1 1 ...
##  $ Length                   : num  326.17 9.24 27.07 190.56 18.73 ...
##  $ Number                   : int  299 9 26 146 16 8 15 38 9 231 ...
##  $ Midpoint                 : int  3128478 3296674 3374366 4281010 4616743 4719724 4811008 4772177 4797430 6053780 ...
##  $ Tortuosity               : num  1.08 1.15 1.21 1.06 1.07 ...
##  $ Distance                 : num  3748 3660 3650 3625 3247 ...
##  $ Width                    : num  4.693 2.402 0.846 4.929 0.662 ...
##  $ Width_cv                 : num  0.278 0.342 0.965 0.136 0.487 ...
##  $ Area                     : num  17.299 4.532 0.562 19.079 0.345 ...
##  $ Volume                   : num  5642.2 41.89 15.22 3635.74 6.46 ...
##  $ Resistance_2             : num  1122.73 5.64 833.53 21.16 186.58 ...
##  $ Resistance_4             : num  1.11e+05 1.89 2.96e+04 1.07 1.18e+03 ...
##  $ Resistance_2ave          : num  150.8 16.3 385.2 79.9 434.6 ...
##  $ Resistance_4ave          : num  27.4 11.3 2152.6 13.2 3961.4 ...
##  $ Or_ij                    : num  191.6 225 56.3 40.3 35.5 ...
##  $ Or_ji                    : num  165 166 -90 -132 -157 ...
##  $ Region                   : num  9084 405 683 4911 492 ...
##  $ Route_factor             : num  1.14 1.18 1.18 1.16 1.11 ...
##  $ Accessibility            : num  0.000963 0.001997 0.001093 0.002051 0.001131 ...
##  $ Accessibility_ratio      : num  3.61 7.31 3.99 7.44 3.67 ...
##  $ Betweenness              : num  28340 28340 28340 85014 28340 ...
##  $ Ai                       : int  2 1 3 3 4 5 6 6 5 5 ...
##  $ Aj                       : int  1 1 1 1 4 5 4 4 5 5 ...
##  $ cord_Rank                : int  20 2 2 18 19 15 3 17 6 16 ...
##  $ length_Disconnected      : int  2 1 2 2 2 1 2 2 1 1 ...
##  $ length_meanDisconnect    : int  3 2 3 3 3 2 3 3 2 2 ...
##  $ width_Disconnected       : int  5 3 1 5 1 1 1 1 2 5 ...
##  $ width_meanDisconnect     : int  6 4 2 6 2 2 2 2 3 6 ...
##  $ volume_Disconnected      : int  2 1 1 2 1 1 1 1 1 2 ...
##  $ volume_meanDisconnect    : int  4 2 2 4 2 2 2 2 2 4 ...
##  $ resistance_Disconnected  : int  3 3 3 3 4 1 4 4 1 1 ...
##  $ resistance_meanDisconnect: int  4 4 4 4 5 2 5 5 2 2 ...
##  $ random_Disconnected      : int  5 2 2 5 5 6 3 5 6 6 ...
##  $ random_meanDisconnect    : int  6 3 3 6 6 7 4 6 7 7 ...
##  $ spatial_Disconnected     : int  14 14 14 14 14 14 14 14 14 14 ...
##  $ spatial_meanDisconnect   : int  15 15 15 15 15 15 15 15 15 15 ...
##  $ Species                  : chr  "Mortierella elongata" "Mortierella elongata" "Mortierella elongata" "Mortierella elongata" ...

2.2. Understanding the variables and their distribution.

More impotantly, what is the distribution of the data? To simply get means, min, max per fungal species per variable:

aggregate(
        Edge_Traits[,
                         c("Width","Length","Area","Volume","Resistance_2ave","Tortuosity","Distance",
                           "Accessibility","Betweenness","Route_factor","Or_ij")],
        by=list(Edge_Traits[which(Edge_Traits$Type=="E"),]$name),
        mean)#Here you  can write different functions: min, max, median. range and summmary is also good because it
##        Group.1    Width   Length      Area    Volume Resistance_2ave
## 1   C34(1)_t11 2.486416 35.62635  6.484219  261.0451       185.76146
## 2   C34(2)_t23 2.842553 38.28422  7.800379  355.1597        95.65841
## 3   C34(3)_t23 3.001343 42.16709  8.648350  423.5895       101.15995
## 4   C35(4)_t30 2.586732 30.21901  7.302022  212.3975       218.03514
## 5  DF19(1)_t11 2.495999 33.08385  6.423266  236.8064       236.37738
## 6  DF19(2)_t11 2.116843 25.48389  5.584297  156.0670      1346.55560
## 7  DF19(3)_t11 2.547124 27.84863  6.594102  198.2312       168.83730
## 8  DF25(4)_t08 2.490902 35.03497  6.422615  252.6609       152.65753
## 9  DF25(5)_t11 2.879607 36.55567  8.144890  321.9221       105.70673
## 10 DF25(6)_t11 2.689017 35.93821  7.304261  287.6657       135.07033
## 11 DF56(4)_t11 3.942069 79.73737 13.818083 1209.7395        74.84091
## 12 DF56(5)_t09 3.972351 85.11932 13.941104 1343.8569        72.07603
## 13 DF56(6)_t09 3.609932 70.31851 12.054374  984.2309        88.14096
## 14    M(4)_t13 2.860984 31.40790  7.721019  272.7007       544.66314
## 15  M(5)_t13_c 2.587538 34.63359  6.684309  251.3199       132.11649
## 16    M(6)_t13 2.850257 36.04745  7.946164  304.1161       104.27262
##    Tortuosity Distance Accessibility Betweenness Route_factor    Or_ij
## 1    1.092237 2730.960   0.002287540  1081660.47     1.116972 121.8803
## 2    1.085628 2870.466   0.002494275   784964.46     1.131151 121.6303
## 3    1.085478 2837.314   0.002518414   760376.74     1.097317 123.7604
## 4    1.087140 2485.268   0.003056472  2107936.15     1.085434 120.4299
## 5    1.092123 2776.072   0.002542657  1610009.10     1.107132 121.0331
## 6    1.126633 2575.005   0.002288031  2251847.21     1.121702 118.4352
## 7    1.091932 2913.884   0.002331193  2707310.98     1.103961 120.2419
## 8    1.088899 3378.191   0.002619193  1279655.41     1.072414 123.9226
## 9    1.086190 3354.245   0.002940076  1097108.80     1.092419 124.2263
## 10   1.086563 3140.293   0.003111686   894980.82     1.079164 123.5433
## 11   1.101663 2732.423   0.003735935    61335.67     1.143124 131.3189
## 12   1.106022 3401.546   0.002962687    45846.92     1.167376 131.3435
## 13   1.109570 3489.348   0.002672755   132083.01     1.170059 128.0034
## 14   1.085376 2552.801   0.002946290  1277518.99     1.129328 120.5754
## 15   1.088701 2805.298   0.002676110  1243594.56     1.127154 123.4909
## 16   1.091450 2637.110   0.003290793  1186738.63     1.114236 121.8883
                #gets you more than one summary statistics, but it can be confusing with so much data.
library(tidyverse)

I had some issues understanding what Resistance is. Playing with the following code allowed me to determine that Resistance_2ave = 10*(Length)/width^2

summary(Edge_Traits$Resistance_2ave)
length(which(Edge_Traits$Width_intact==0))
Edge_Traits%>%
        #filter(Area!=0)%>%
        #filter(Resistance_2ave>500)%>%
        mutate(MyResistance=Length/(Width/2)^2)%>%
        mutate(Factor=Resistance_2ave/MyResistance)%>%
        select(Species,name,Length,Width,Resistance_2ave)%>%
        ggplot()+
        aes(y=Resistance_2ave,x=name,fill=name)+
        geom_boxplot()+
        facet_grid(. ~ Species, scales = "free")+
        theme(legend.position = "none")
  

length(which(Edge_Traits$Resistance_2ave>500))
Edge_Traits_c<-Edge_Traits

Edge_Traits<-do.call(rbind,
lapply(
split(Edge_Traits,Edge_Traits$name),head))

Visualinzing as simple historgrams helps. To make those, I use the suite of functions in the package tidyverse.

First, reorganizing the dataframe helps so the figures are made easier

Re_org<-
        Edge_Traits%>%
        #filter(Area!=0)%>%
        #mutate(MyResistance=Length/(Width/2)^2)%>%
        select(c("name","Species","Width","Length","Area","Volume","Resistance_2ave","Tortuosity","Distance",
                 "Accessibility","Betweenness","Route_factor","Or_ij"))%>%
        group_by(name)%>%
        gather(key=variable,
               value=value,Width:Or_ij)

Now we can make simple histograms

Note: I am grouping the variables in different sets. Each set represents (to me) an intuitively logical set of related variables

Hist_Width_Length_Distance_1<-
        Re_org%>%
        filter(variable %in% c("Width","Length","Distance"))%>%#1_The completely indepedent variables
        
        ggplot()+
        aes(value,fill=name)+
        geom_histogram()+
        facet_wrap(Species ~ variable, scales = "free",nrow = 6,ncol = 3)+
        theme(legend.position = "none")
  
Hist_Width_Length_Area_Vol_2<-
          Re_org%>%
        
        filter(variable %in% c("Width","Length","Area","Volume"))%>%#2_The geometric ones depending on width and length
        
        ggplot()+
        aes(value,fill=name)+
        geom_histogram()+
        facet_wrap(Species ~ variable, scales = "free",nrow = 6,ncol = 4)+
        theme(legend.position = "none")

Hist_Width_Length_Resistance_3<-
          Re_org%>%
        
        filter(variable %in% c("Width","Length","Resistance_2ave"))%>%#3_The "transport" one depending on width and length
        
        ggplot()+
        aes(value,fill=name)+
        geom_histogram()+
        facet_wrap(Species ~ variable, scales = "free",nrow = 6,ncol = 3)+
        theme(legend.position = "none")

#Hist_Length_Tortuosity_4<-For this one see below

Hist_Resistance_Accessibility_Betweenness_5<-
          Re_org%>%
        
        filter(variable %in% c("Resistance_2ave","Accessibility","Betweenness"))%>%#5_The "transport" ones depending all on Resistance to some extent
        
        ggplot()+
        aes(value,fill=name)+
        geom_histogram()+
        facet_wrap(Species ~ variable, scales = "free",nrow = 6,ncol = 3)+
        theme(legend.position = "none")

Hist_Distance_Route_factor_6<-
        
        Re_org%>%
        
        filter(variable %in% c("Route_factor","Distance"))%>%#6_The only that depends on distance
        
        ggplot()+
        aes(value,fill=name)+
        geom_histogram()+
        facet_wrap(Species ~ variable, scales = "free",nrow = 6,ncol = 2)+
        theme(legend.position = "none")

About tortuosity

tapply(Edge_Traits$Tortuosity,Edge_Traits$name,summary)
tapply(Edge_Traits$Tortuosity,Edge_Traits$name,function(x){length(which(x>1.5))})
tapply(Edge_Traits$Tortuosity,Edge_Traits$name,function(x){length(which(x>1.5))/length(x)})
tapply(Edge_Traits$Tortuosity,Edge_Traits$name,function(x){length(which(x>1.5))})
tapply(Edge_Traits$Tortuosity,Edge_Traits$name,length)
Hist_Length_Tortuosity_4<-
Edge_Traits%>%
        filter(Tortuosity<1.5)%>%
        select(c("name","Species","Width","Length","Area","Volume","Resistance_2ave","Tortuosity","Distance",
                 "Accessibility","Betweenness","Route_factor","Or_ij"))%>%
        group_by(name)%>%
        gather(key=variable,
               value=value,Width:Or_ij)%>%
        
        filter(variable %in% c("Length","Tortuosity"))%>%#4_Tortuosity has little variation and depends on Length
        ggplot()+
        aes(value,fill=name)+
        geom_histogram()+
        facet_wrap(Species ~ variable, scales = "free",nrow = 6,ncol = 2)+
        theme(legend.position = "none")

Looking at the plots

Note: Here the display is not optimal. When you execute this code in your computer it looks much better

Hist_Width_Length_Distance_1
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Hist_Width_Length_Area_Vol_2
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Hist_Width_Length_Resistance_3
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Hist_Length_Tortuosity_4
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Hist_Resistance_Accessibility_Betweenness_5
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Hist_Distance_Route_factor_6
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Form these plots one learns that:

  1. Some variables are mathematically correlated:
  • Area= (pi/4)*Width^2

  • Volume= (pi/4)(Width^2)Length

  • Resitance= 10*Length/Width^2

  • Thus for subsequent analysis I will only use variables that are not (at least so easily) related to each other:

    • Width, Lenght, Tortuosity, Distance, Accessibility, Betweenness, Route Factor
  1. The distribution of the data for a variable is similar across ose species. In summary:
  • Width: Varies from almost uniform to normal to bimodal to right skewed, and this depends on the species
  • Length: left skewed
  • Torturosity: “A bit” normal, still data is concentrated to the left. It is completely left skewed with tortuosity values higher than 1.5 are included which only represent less than 1% of the data
  • Distance: Normally distributed
  • Accessibility: A bit" normal, still data is concentrated to the left
  • Betwenness: Highly right skewed
  • Route Factor: A bit" normal, still data is concentrated to the left

What kind of transformations are needed for betweeness, Length (the ones that are clearly left-skewed) and Tortuosity

Betweenness can be log transformed (adding 1)

Edge_Traits%>%
        #filter(Tortuosity<1.5)%>%
        select(c("name","Species","Width","Length","Area","Volume","Resistance_2ave","Tortuosity","Distance",
                 "Accessibility","Betweenness","Route_factor","Or_ij"))%>%
        mutate(Log_Betweenness=log10(Betweenness+1))%>%
        group_by(name)%>%
        gather(key=variable,
               value=value,Width:Log_Betweenness)%>%
        
        filter(variable %in% c("Log_Betweenness","Distance"))%>%#4_Tortuosity has little variation and depends on Length
        ggplot()+
        aes(value,fill=name)+
        geom_histogram()+
        facet_wrap(Species ~ variable, scales = "free",nrow = 6,ncol = 2)+
        theme(legend.position = "none")

Length can be log transformed and that makes it very normally ditributed

Edge_Traits%>%
        #filter(Tortuosity<1.5)%>%
        select(c("name","Species","Width","Length","Area","Volume","Resistance_2ave","Tortuosity","Distance",
                 "Accessibility","Betweenness","Route_factor","Or_ij"))%>%
        mutate(Log_Length=log10(Length))%>%
        group_by(name)%>%
        gather(key=variable,
               value=value,Width:Log_Length)%>%
        
        filter(variable %in% c("Log_Length","Distance"))%>%#4_Tortuosity has little variation and depends on Length
        ggplot()+
        aes(value,fill=name)+
        geom_histogram()+
        facet_wrap(Species ~ variable, scales = "free",nrow = 6,ncol = 2)+
        theme(legend.position = "none")

2.3. Understanding relationships among variables.

Before doing a correlogram of everything with everythin. Here I want to test specific relationships that I think might be interesting biologically

LENGTH AND WIDTH

Log_Length_Width<-

#Length_Width<-
  Edge_Traits%>%
  ggplot()+
  aes(x=log10(Width),y=log10(Length),color=name)+
  #aes(x=Width,y=Length,color=name)+
  geom_point(alpha=0.8)+
  facet_wrap(. ~ Species, scales = "free",nrow = 6,ncol = 3)+
  theme(legend.position = "none")

Length_Width<-
  Edge_Traits%>%
  ggplot()+
  #aes(x=log10(Width),y=log10(Length),color=name)+
  aes(x=Width,y=Length,color=name)+
  geom_point(alpha=0.8)+
  facet_wrap(. ~ Species, scales = "free",nrow = 6,ncol = 3)+
  theme(legend.position = "none")
Length_Width

Log_Length_Width

The only think I can tell from this one is that the thinnest hyphae have medium size length. Really long hyphae cannot be thin. There seems to be a lower boundary: the thinnest hypahe get longer up to a point where it is impossible to go thinniest and long. Note! Assuming this follows the two are connected by a power law

LENGTH; WIDTH AND DISTANCE

Log_Length_Distance<-
  Edge_Traits%>%
        ggplot()+
        aes(x=Distance,y=log10(Length),color=name)+
        geom_point(alpha=0.8)+
        facet_wrap(. ~ Species, scales = "free",nrow = 6,ncol = 3)+
        theme(legend.position = "none")

Distance_Lengt_Width<-
  Edge_Traits%>%
  filter(Area!=0)%>%
  ggplot()+
  aes(x=Distance,y=Length,color=Width)+
  #aes(Distance,Volume,color=Volume)+
  geom_point()+
  #geom_hex() +
  #geom_bin2d()+
  scale_color_continuous(type = "viridis")+
  #scale_fill_continuous(type = "viridis")+
  theme_bw()+
  facet_wrap(.~Species, scales = "free",nrow = 6,ncol = 3)

library(hexbin)

Distance_Volume<-
        Edge_Traits%>%
        filter(Area!=0)%>%
        ggplot()+
        aes(x=Distance,y=Volume)+
        #aes(Distance,Volume,color=Volume)+
        #geom_point()+
        geom_hex() +
        #geom_bin2d()+
        #scale_color_continuous(type = "viridis")+
        scale_fill_continuous(type = "viridis")+
        theme_bw()+
        facet_wrap(.~Species, scales = "free",nrow = 6,ncol = 3)
Log_Length_Distance

Out of this one is clear that there is no relationship between length and distance

RESISTANCE WIDTH AND LENGTH (THIS IS MAINLY TO TEST THE MATHEMATICAL RELATIONSHIP AMONG THEM)

#Resistance_Width_Length<-
Log_Resistance_Width_Length<-
        Edge_Traits%>%
        ggplot()+
        #aes(x=Distance,y=Volume)+
        aes(x=log10(Length),y=log10(Resistance_2ave),color=log10(Width))+
        geom_point()+
        #geom_hex() +
        #geom_bin2d()+
        scale_color_continuous(type = "viridis")+
        #scale_fill_continuous(type = "viridis")+
        theme_bw()+
        facet_wrap(.~Species, scales = "free",nrow = 6,ncol = 3)
Log_Resistance_Width_Length

This plot confirms the relationship between resistance and lenght and width

BETWEENNESS AND DISTANCE

Log_Betweenness_Distance<-
        Edge_Traits%>%
        ggplot()+
        aes(y=log10(Betweenness+1),x=Distance)+
        #aes(Distance,Volume,color=Volume)+
        #geom_point()+
        geom_hex() +
        #geom_bin2d()+
        #scale_color_continuous(type = "viridis")+
        scale_fill_continuous(type = "viridis")+
        theme_bw()+
        facet_wrap(.~Species, scales = "free",nrow = 2,ncol = 3)
Log_Betweenness_Distance

ROUTE FACTOR AND WIDTH

RouteFactor_Width<-
  Edge_Traits%>%
  ggplot()+
  aes(y=Width,x=Route_factor,color=name)+
    geom_point()+
  #geom_hex() +
  #geom_bin2d()+
  geom_point(alpha=0.8,size=2)+
  facet_wrap(. ~ Species, scales = "free",nrow = 6,ncol = 3)+
  theme(legend.position = "none")
RouteFactor_Width

Correlograms

library(GGally)
Edge_Traits%>%
  filter(Species=="Mortierella elongata")%>%
  filter(Tortuosity<1.5)%>%
        
  mutate(Log_Betweenness=log10(Betweenness+1))%>%
  mutate(Log_Length=log10(Length))%>%
  mutate(Species=as.factor(Species))%>%
  select(c("Width","Log_Length","Tortuosity","Distance",
                 "Accessibility","Log_Betweenness","Route_factor","Species"))%>%
  ggpairs(title="Mortierella elongata",columns = 1:7,ggplot2::aes(color=Species))

Edge_Traits%>%
  filter(Species=="Umbelopsis isabellina")%>%
  filter(Tortuosity<1.5)%>%
        
  mutate(Log_Betweenness=log10(Betweenness+1))%>%
  mutate(Log_Length=log10(Length))%>%
  mutate(Species=as.factor(Species))%>%
  select(c("Width","Log_Length","Tortuosity","Distance",
                 "Accessibility","Log_Betweenness","Route_factor","Species"))%>%
  ggpairs(title="Umbelopsis isabellina",columns = 1:7,ggplot2::aes(color=Species))

Edge_Traits%>%
  filter(Species=="Mortierella alpina")%>%
  filter(Tortuosity<1.5)%>%
        
  mutate(Log_Betweenness=log10(Betweenness+1))%>%
  mutate(Log_Length=log10(Length))%>%
  mutate(Species=as.factor(Species))%>%
  select(c("Width","Log_Length","Tortuosity","Distance",
                 "Accessibility","Log_Betweenness","Route_factor","Species"))%>%
  ggpairs(title="Mortierella alpina",columns = 1:7,ggplot2::aes(color=Species))

Edge_Traits%>%
  filter(Species=="Mortierella elongata2")%>%
  filter(Tortuosity<1.5)%>%
        
  mutate(Log_Betweenness=log10(Betweenness+1))%>%
  mutate(Log_Length=log10(Length))%>%
  mutate(Species=as.factor(Species))%>%
  select(c("Width","Log_Length","Tortuosity","Distance",
                 "Accessibility","Log_Betweenness","Route_factor","Species"))%>%
  ggpairs(title="Mortierella elongata2",columns = 1:7,ggplot2::aes(color=Species))

Edge_Traits%>%
  filter(Species=="Mucor fragilis")%>%
  filter(Tortuosity<1.5)%>%
        
  mutate(Log_Betweenness=log10(Betweenness+1))%>%
  mutate(Log_Length=log10(Length))%>%
  mutate(Species=as.factor(Species))%>%
  select(c("Width","Log_Length","Tortuosity","Distance",
                 "Accessibility","Log_Betweenness","Route_factor","Species"))%>%
  ggpairs(title="Mucor fragilis",columns = 1:7,ggplot2::aes(color=Species))

Edge_Traits%>%
  filter(Species=="Mortierella alpina2")%>%
  filter(Tortuosity<1.5)%>%
        
  mutate(Log_Betweenness=log10(Betweenness+1))%>%
  mutate(Log_Length=log10(Length))%>%
  mutate(Species=as.factor(Species))%>%
  select(c("Width","Log_Length","Tortuosity","Distance",
                 "Accessibility","Log_Betweenness","Route_factor","Species"))%>%
  ggpairs(title="Mortierella alpina2",columns = 1:7,ggplot2::aes(color=Species))

Edge_Traits%>%
  #filter(Species=="Mortierella elongata")%>%
  filter(Tortuosity<1.5)%>%
        
  mutate(Log_Betweenness=log10(Betweenness+1))%>%
  mutate(Log_Length=log10(Length))%>%
  mutate(Species=as.factor(Species))%>%
  select(c("Width","Log_Length","Tortuosity","Distance",
                 "Accessibility","Log_Betweenness","Route_factor","Species"))%>%
  ggpairs(title="All",columns = 1:7)

Edge_Traits%>%
  #filter(Species=="Mortierella elongata")%>%
  filter(Tortuosity<1.5)%>%
        
  mutate(Log_Betweenness=log10(Betweenness+1))%>%
  mutate(Log_Length=log10(Length))%>%
  mutate(Species=as.factor(Species))%>%
  select(c("Width","Log_Length","Tortuosity","Distance",
                 "Accessibility","Log_Betweenness","Route_factor","Species"))%>%
  ggpairs(title="All",columns = 1:7,ggplot2::aes(color=Species))